tablew <- function(..., wname="weight", uname="auto",  dataset.name=dsn) {
  
  #   Args: Variables of tabulation, universe specification, weights, dataset name
  # Result: n-dimensional array with dimnames assigned
  
  source("Rfunctions.base/getvariable.R")
  source("Rfunctions.base/getmetadata.R")
  source("Rfunctions.base/tablew.base.R")
  
  # Get variables of tabulation
  variable.list <- as.list(substitute(list(...)))[-1L]
  vnames  <- character(0)
  for (i in 1:length(variable.list)) {
    vnames <- c(vnames, as.character(variable.list[[i]]))
    getvariable(vnames[i], dataset.name)
  }
  
  # Get weights
  if (wname == "none") {
    weights <- rep(1, times=getmetadata()$numrecords)
  } else {
    getvariable("weight", dataset.name)
    weights <- weight
  }
  
  # Get universe
  universe <- rep(TRUE, times=getmetadata()$numrecords)
  
  # Call tablew.base() to create table
  x <- do.call(tablew.base, list(vnames=vnames, weights=weight, universe=universe))
  
  # Construct table name
  #   Variables of tabulation portion
  if (length(vnames) == 1) {
    table.name <- paste(vnames, ".frq", sep="")
  } else {
    table.name <- paste(vnames, collapse=".")
  }
  #   Weights portion
  if (wname == "none") {
    table.name <- paste(table.name, ".unweighted", sep="")
  }
  
  # Assign table to name
  assign(table.name, x, envir=globalenv())
  
  # Print message
  cat(paste("\"", table.name, "\" assigned", sep=""))
  
}